package cn.iocoder.yudao.module.data.service.text2sql.pojo;

import cn.hutool.core.util.StrUtil;
import lombok.Data;
import org.apache.commons.lang3.tuple.Triple;

@Data
public class QueryStatement {

    private Long dataSetId;
    private String dataSetName;
    private String sql;
    private String errMsg;
    //带结构体，聚合等能力
//    private StructQuery structQuery;
    private SqlQuery sqlQuery;
    //具备连接能力
//    private OntologyQuery ontologyQuery;
    private QueryState status = QueryState.SUCCESS;
    private Boolean isS2SQL = false;
    private Boolean enableOptimize = true;
    private Triple<String, String, String> minMaxTime;
//    private Ontology ontology;
//    private SemanticSchemaResp semanticSchema;
    private Integer limit = 1000;
    private Boolean isTranslated = false;

    public boolean isOk() {
        return StrUtil.isBlank(errMsg) && StrUtil.isNotBlank(sql);
    }

    public boolean isTranslated() {
        return isTranslated != null && isTranslated && isOk();
    }
}